#!/bin/bash

set -eu
# set -x

export install_path=/usr/local/Ascend/ascend-toolkit/latest
export DDK_PATH=${install_path}
export NPU_HOST_LIB=${install_path}/acllib/lib64/stub
export PATH=/usr/local/python3.7.5/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH
if [ ! `echo $PYTHONPATH` ];then
    export PYTHONPATH=${install_path}/atc/python/site-packages
else
    export PYTHONPATH=${install_path}/atc/python/site-packages:$PYTHONPATH
fi
export LD_LIBRARY_PATH=${install_path}/atc/lib64:${install_path}/acllib/lib64:$LD_LIBRARY_PATH
export ASCEND_OPP_PATH=${install_path}/opp

cmp_script=${install_path}/tools/operator_cmp/compare/msaccucmp.py

input=$1
output=$2
mkdir -p $output
if [ $# == 3 ];
then
    format=$3
    python3.7 $cmp_script convert -d $input -out $output -f $format
else
    python3.7 $cmp_script convert -d $input -out $output
fi
